package com.sqly.doc;


import android.annotation.SuppressLint;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.sqly.doc.menu.jzyy.jzyy_list;
import com.sqly.doc.menu.qianyue.yqy_data_list;
import com.sqly.doc.menu.qianyue.qianyue_list;
import com.sqly.doc.menu.yyye.yyye_menu;
import com.sqly.doc.view.AdView;
import com.sqly.doc.view.ImageInfo;

import java.util.ArrayList;

//import cn.pedant.SweetAlert.SweetAlertDialog;

@SuppressLint("NewApi")
public class qy_fragment extends Fragment {
    private ArrayList<ImageInfo> ImageInfoArr;
    private AdView adView;
    LinearLayout qy_ll, fwjh_ll, fwjl_ll, jzyy_ll, jkglfa_ll, jkglln_ll, jkpgb_ll;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        View view = inflater.inflate(R.layout.qy_fragment, null);
        adView = (AdView) view.findViewById(R.id.adview);
        //滚动图片
        loadImagge();
        initView(view);
        return view;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onActivityCreated(savedInstanceState);
    }

    public void initView(View v){
        qy_ll =(LinearLayout)v.findViewById(R.id.qy_ll);
        qy_ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(), qianyue_list.class));
            }
        });
        fwjh_ll =(LinearLayout)v.findViewById(R.id.fwjh_ll);
        fwjh_ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(), yqy_data_list.class).putExtra("flag", "jh"));
            }
        });
        fwjl_ll =(LinearLayout)v.findViewById(R.id.fwjl_ll);
        fwjl_ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),yqy_data_list.class).putExtra("flag", "jl"));
            }
        });

        jkglfa_ll =(LinearLayout)v.findViewById(R.id.jkglfa_ll);
        jkglfa_ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),yqy_data_list.class).putExtra("flag", "jkglfa"));
            }
        });

        jkglln_ll =(LinearLayout)v.findViewById(R.id.jkglln_ll);
        jkglln_ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),yqy_data_list.class).putExtra("flag", "jkglln"));
            }
        });

        jkpgb_ll =(LinearLayout)v.findViewById(R.id.jkpgb_ll);
        jkpgb_ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(),yqy_data_list.class).putExtra("flag", "jkpgb"));
            }
        });

        jzyy_ll =(LinearLayout)v.findViewById(R.id.jzyy_ll);
        jzyy_ll.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(), jzyy_list.class));
            }
        });

    }

    public void loadImagge() {
        ImageInfoArr = new ArrayList<ImageInfo>();
        ImageInfo f = new ImageInfo();
        f.setImagepath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509030659568&di=06bffd9f40ea2ca44ce10f423952b449&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimage%2Fc0%253Dshijue1%252C0%252C0%252C294%252C40%2Fsign%3Dbd95dc96b3389b502cf2e811ed5c8fa8%2F4ec2d5628535e5dd6c5563577cc6a7efce1b6239.jpg");
        ImageInfoArr.add(f);
        ImageInfo f1 = new ImageInfo();
        f1.setImagepath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509030659568&di=d91f867cc79a8b29d89f23d7edafb74a&imgtype=0&src=http%3A%2F%2Fimage.suning.cn%2Fuimg%2Fsop%2Fcommodity%2F201408040415267430_x.jpg");
        ImageInfoArr.add(f1);
        ImageInfo f2 = new ImageInfo();
        f2.setImagepath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509030659568&di=751e4ee58e9c72c4e556ddc3ae3a9968&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimage%2Fc0%253Dshijue1%252C0%252C0%252C294%252C40%2Fsign%3D0aa8ee4c05b30f242197e440a0fcbb36%2F43a7d933c895d143dc6aa10e79f082025aaf07fa.jpg");
        ImageInfoArr.add(f2);
        ImageInfo f3 = new ImageInfo();
        f3.setImagepath("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1509030659567&di=0b0e2fca08da072b52adff84345e8070&imgtype=0&src=http%3A%2F%2Fimgsrc.baidu.com%2Fimage%2Fc0%253Dshijue1%252C0%252C0%252C294%252C40%2Fsign%3Db0eba2c45d2c11dfcadcb7600b4e08a5%2Fa8ec8a13632762d02531c198aaec08fa513dc68e.jpg");
        ImageInfoArr.add(f3);
        adView.setWebDate(getActivity(), ImageInfoArr);
    }

}
